<template>
  <li class="course-item" @click="clickCourse">
    <div class="course-item-left">
      <img v-bind:src="item.courseImgUrl" alt="">
      <!--  -->
      <button class="badge" v-if="item.newAudioCount>0">{{item.newAudioCount}}</button>
    </div>

    <div class="course-item-right">
      <div>
        <h3 class="course-item-name">{{item.courseName}}</h3>
        <div class="course-item-audio">{{item.lastAudioName}}</div>
      </div>
    </div>
  </li>
</template>

<script>

// import { Toast } from 'mint-ui';

export default {
  name: 'sq-course-order',
  props: {
    item: {
      type: Object,
      required: true
    }
  },
  methods: {
    clickCourse() {
//      if (this.$props.item.status === 0){
//        Toast({
//          message: '您购买的课程已经下架',
//          duration: 2000,
//          className: 'custom-toast'
//        });
//        return;
//      }
      this.$emit('clickCourse');
    }
  }
}
</script>

<!-- custom mint-ui -->
<style scoped>

  .course-item {
     width:100%;
     display:flex;
     border-bottom:1px solid #eee;
  }

  .course-item .course-item-left {
    padding: 12px 16px 0px 12px;
    position: relative;
    flex: 0 0 auto;
  }
  .course-item .course-item-left img{
     width:49px;
     height:49px;
  }

  .course-item .course-item-right {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: left;
    padding-right:10px;
    width:100%;
  }

  /* name & brief */
  h3.course-item-name {
    margin: 15px 0px 6px 0px;
    font-size: 16px;
    color: #000000;
    line-height: 19px;
    font-weight: normal;
  }

  .course-item div.course-item-audio {
    font-size: 14px;
    line-height: 19px;
    margin-bottom: 15px;
    color: #666666;
  }

  .badge {
    position: absolute;
    right: 5px;
    top: 5px;
    width: 16px;
    height: 16px;
    background-color: #f51212;
    border-radius: 8px;
    color: #fff;
    border: 0px;
    margin: 0px;
    padding: 0px;
  }

</style>

